package com.adley.service.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;

@RestController
public class HelloController {

    @GetMapping("/{servicename}/hello")
    public String hello(@PathVariable(name="servicename") String serviceName) {
        WebClient webClient = WebClient.builder().baseUrl("http://localhost:8666").build();
        return webClient.get().uri("/"+serviceName+"/hello").retrieve().bodyToMono(String.class).block();
    }
}